# $Id: PKGBUILD 78426 2012-10-18 01:51:03Z ebelanger $
# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Geoffroy Carrier <gcarrier@aur.archlinux.org>
# Contributor: G_Syme <demichan(at)mail(dot)upb(dot)de>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>

pkgname=impressive
pkgver=0.10.3
pkgrel=5
pkgdesc='A fancy PDF presentation program (previously known as KeyJNote).'
arch=('any')
url='http://impressive.sourceforge.net'
license=('GPL2')
depends=('python2-pygame' 'python2-opengl' 'python2-imaging' 'ghostscript')
optdepends=('pdftk: for retrieving PDF metadata (page titles, hyperlinks)'
            'xdg-utils: for starting web or e-mail hyperlinks from PDF documents'
            'mplayer: for sound and video playback')
provides=('keyjnote=0.10.3')
conflicts=('keyjnote')
replaces=('keyjnote')
source=(http://downloads.sourceforge.net/${pkgname}/Impressive-${pkgver}.tar.gz)
sha256sums=('bb4865376db0df3fe307b5f60bddc2bbaf18d2ccb099b2d51bf1723dd94af95e')

build() {
  cd "${srcdir}/Impressive-${pkgver}"

# python2 fix
  for file in $(find . -name '*.py' -print); do
      sed -i 's_#!.*/usr/bin/python_#!/usr/bin/python2_' $file
      sed -i 's_#!.*/usr/bin/env.*python_#!/usr/bin/env python2_' $file
  done
}

package() {
  cd "${srcdir}/Impressive-${pkgver}"

  install -d -m755 "${pkgdir}"/usr/{bin,share/{doc/${pkgname},man/man1}}
  install -m755 ${pkgname}.py "${pkgdir}/usr/bin/${pkgname}"
  ln -s ${pkgname} "${pkgdir}/usr/bin/keyjnote"
  install -m644 ${pkgname}.html demo.pdf changelog.txt "${pkgdir}/usr/share/doc/${pkgname}/"
  install -m644 ${pkgname}.1 "${pkgdir}/usr/share/man/man1/"
}
